package com.oig.sys.base.dao;

import com.oig.sys.base.entity.TbHarbor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;


/**
@author wuxl
*/
public interface ITbHarborDao extends JpaRepository<TbHarbor, Integer>, JpaSpecificationExecutor<TbHarbor> {

	TbHarbor getTbHarborById(Integer id);

	TbHarbor getByName(String name);

	TbHarbor getByOldCode(String oldCode);

	@Query("from TbHarbor e where e.code=:code")
	TbHarbor getByCode(@Param("code") String code);

	@Query("from TbHarbor e where e.code=:code and e.id<>:id")
	TbHarbor getByCodeAndIdExists(@Param("code") String code, @Param("id")Integer id);
}
